<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        img {
            width: 300px;
        }
    </style>

</head>

<body>
    <button id="zxc">周星驰</button>
    <button id="hjj">黄家驹</button>
    <br />
    <img src="img/周星驰01.jpg" alt="" title="周星驰">

    <script>
        // 修改元素属性: ele.属性 = value  如 src, title, id, name, href
        let zxc = document.querySelector('#zxc');
        let hjj = document.querySelector('#hjj');
        let img = document.querySelector('img');
        console.log(img.src);
        console.log(img.title);
        zxc.onclick = function () {
            img.src = 'img/周星驰01.jpg';
            img.title = '周星驰';
        }

        hjj.onclick = function () {
            img.src = 'img/黄家驹.jpg';
            img.title = '黄家驹';
        }

    </script>


</body>

</html>